﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Company.Merchandising.BusinessLayer.DataEntities;

namespace Company.Merchandising.DataAccessLayer.DataAccessCommon
{
	public class DACProvince : DACBase
	{
		public DACProvince(MerchModelEntities modelEntities) : base(modelEntities) { }

		public IQueryable<Province> GetAllProvinces()
		{
			return from prov in _modelEntities.Province select prov;
		}

		public Province GetProvinceById(int provinceId)
		{
			return (from prov in _modelEntities.Province where prov.Id == provinceId select prov).FirstOrDefault();
		}

		public IQueryable<Province> GetProvincesByName(string provinceName)
		{
			return from prov in _modelEntities.Province where prov.Name == provinceName select prov;
		}

		public IQueryable<Province> GetProvincesByNameAndOtherId(string provinceName, int provinceId)
		{
			return from prov in _modelEntities.Province where prov.Name == provinceName && prov.Id != provinceId select prov;
		}
	}
}
